package org.example.domain.repository;

import com.github.pagehelper.PageInfo;
import org.example.domain.model.entity.url.UrlShortener;
import org.example.domain.model.entity.url.req.UrlShortenerSelectReq;
import org.example.domain.model.entity.url.resp.QueryGroupByCountResp;
import org.example.domain.model.entity.url.vo.UrlShortenerUpdateVo;
import org.example.domain.model.entity.url.vo.UrlShortenerVo;

import java.util.List;
import java.util.Optional;

public interface UrlShortenerRepository {

    void insertUrlShortener(UrlShortener urlShortener);

    /**
     *
     * @param fullShortUrl 完整短链接
     * @return
     */
    Optional<UrlShortenerVo> selectUrlShortener(String fullShortUrl);

    void updateUrlShortEnerByFullShortUrl(UrlShortenerUpdateVo urlShortenerUpdateVo, String fullShortUrl, String gid);

    PageInfo<UrlShortener> selectByPage(UrlShortenerSelectReq urlShortenerSelectReq);

    List<QueryGroupByCountResp>  queryGroupByCount(List<String> gidList);

    void incrementStats(String gid, String fullShortUrl, Integer totalPv, Integer totalUv, Integer totalUip);
}
